package com.yunhe.option.repository.data;

import com.yunhe.option.domain.data.Version;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface VersionRepository extends JpaRepository<Version, Long> {

    @Query(value = "select * from data_version where type=:type order by id desc limit 1", nativeQuery = true)
    Version searchLatestVersionByType(@Param("type") String type);

    @Query("select v from Version v where v.type=:type")
    Version searchLatestVersion(@Param("type") String type);
}
